import React ,{ComponentType, PropsWithChildren}from 'react'
import {Navigate} from 'react-router-dom'

const Hoc_login = (Com:ComponentType<object>) => {
    let token= localStorage.getItem("token")
    
    return (props:PropsWithChildren<object>)=>{
            if(token){
                return <Com {...props}></Com>
            }else{
                return <Navigate to='/login'></Navigate>
            }
    }
}

export default Hoc_login
